//
//  NSObject+CycleObjectTool.m
//  CycleControlFunction
//
//  Created by 苹果笔记本 on 2020/10/28.
//  Copyright © 2020 cycle. All rights reserved.
//

#import "NSObject+CycleObjectTool.h"

@implementation NSObject (CycleObjectTool)
/** 1.清除webView缓存和cookie url*/
- (void)cycle_cleanCacheAndCookie
{
    //清除cookies
    NSHTTPCookie *cookie;

    NSHTTPCookieStorage *CookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];

    for(cookie in [CookieStorage cookies]){

        [CookieStorage deleteCookie:cookie];

    }
    //清除UIWebView的缓存

    [[NSURLCache sharedURLCache] removeAllCachedResponses];

    NSURLCache * cache = [NSURLCache sharedURLCache];

    [cache removeAllCachedResponses];

    [cache setDiskCapacity:0];

    [cache setMemoryCapacity:0];

}
@end
